﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>${setting.siteName} - 新增患者表</title>
    <meta name="keywords" content="${setting.siteName}">
    <meta name="description" content="${setting.siteName}">
    <!-- BEGIN HEADER -->
    [#include "/admin/include/style.ftl"]
    <!-- END HEADER -->
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content  animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>新增患者表</h5>
                    <div class="ibox-tools">
                        <button type="button" class="btn btn-outline btn-white btn-xs" id="btn-return-loippi"
                                onclick="location.href='${base}/admin/patient/list.jhtml'"><i
                                    class="fa fa-reply-all"></i> 返回列表
                        </button>
                    </div>
                </div>
                <div class="ibox-content">
                    <form id="inputForm" class="form-horizontal" action="save.jhtml" method="post">

                        <!--/row-->
                        <div class="form-group">
                            <div class="row">
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label">姓名</label>
                                    <div class="col-sm-9">
                                        <input type="text" name="name" class="form-control" maxlength="200"
                                               required="required"/>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label">性别</label>
                                    <div class="col-sm-9">
                                        <input type="radio" name="sex" value=0/>女
                                        <input type="radio" name="sex" value=1/>男
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--/row-->

                        <div class="form-group">
                            <div class="row">
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label">年龄</label>
                                    <div class="col-sm-9">
                                        <input type="number" name="age" class="form-control" maxlength="200"/>
                                        <span style=" position: absolute; top: 2%; right: 3%; display: table-cell;
		                                background-color: #ffffff;white-space: nowrap; padding: 5px 8px;">岁</span>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label">身高</label>
                                    <div class="col-sm-9">
                                        <input type="number" name="height" class="form-control" maxlength="200"/>
                                        <span style=" position: absolute; top: 2%; right: 3%; display: table-cell;
		                                background-color: #ffffff;white-space: nowrap; padding: 5px 8px;">cm</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--/row-->

                        <div class="form-group">
                            <div class="row">
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label">体重</label>
                                    <div class="col-sm-9">
                                        <input type="number" name="weight" class="form-control" maxlength="200"/>
                                        <span style=" position: absolute; top: 2%; right: 3%; display: table-cell;
		                                background-color: #ffffff;white-space: nowrap; padding: 5px 8px;">kg</span>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label">电话</label>
                                    <div class="col-sm-9">
                                        <input type="number" name="phone" class="form-control" maxlength="200"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--/row-->

                        <div class="form-group">
                            <div class="row">
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label">地址</label>
                                    <div id="dist" class="col-sm-9" data-toggle="distpicker">
                                        <input type="text" id="address" name="address" class="form-control"
                                               maxlength="200"/>
                                        [#--		                                <select id="province" class="col-sm-4 form-control" data-province="--- 选择省 ---" style="width: 150px"></select>--]
                                        [#--		                                <select id="city" class="col-sm-4 form-control" data-city="---选择市 ---" style="width: 150px"></select>--]
                                        [#--                                    <select id="area" class="col-sm-4 form-control" data-district="--- 选择区 ---" style="width: 150px"></select>--]
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-sm-3 control-label"><span class="required"> * </span>用户昵称</label>
                                    <div class="col-sm-9">
                                        <select id="users" class="form-control" name="userId" maxlength="200"
                                                required="required">
                                            <option value="">请选择</option>
                                            [#list users as us]
                                                <option value="${us.id}">${us.nickName}</option>
                                            [/#list]
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--/row-->

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-12 col-sm-offset-10">
                                <button type="button" class="btn btn-default" onclick="window.history.back();">返回
                                </button>
                                <button class="btn btn-success" type="submit">保存内容</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- BEGIN Script -->
[#include "/admin/include/script.ftl"]
<!-- END Script -->
<script>

    $(document).ready(function () {
        [@flash_message /]
        $(".chosen-select").chosen({width: "100%"});
        $(".input-daterange").datepicker({keyboardNavigation: false, forceParse: false, autoclose: true});

        $(".browserButton").browser({
            callback: function (url) {
                $("#" + $(this).attr('for')).val(url);
            }
        });

        $(".input-group.date").datepicker({
            todayBtn: "linked",
            keyboardNavigation: false,
            forceParse: false,
            calendarWeeks: true,
            autoclose: true
        });
        // if ($("#provinceSelect").text()!= null && $("#citySelect").text()!=null && $("#districtSelect").text()!=null)
        //   var areaName = $("#provinceSelect").text() +$("#citySelect").text() +  $("#districtSelect").text();
        // $("input[name=areaName]").val(areaName);
        $.validator.addMethod("isMobile", function (value, element) {
            var length = value.length;
            var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
            return this.optional(element) || (length == 11 && mobile.test(value));
        }, "请正确填写您的手机号码");
        $("#inputForm").validate({
            rules: {
                name: {
                    required: true
                },
                phone: {
                    required: true,
                    isMobile: true
                },
                userId: {
                    required: true
                }
            },
            messages: {}
        });
        $(":input").change(function () {
            var num = $(this).val();
            if ($(this).attr("type") != null && $(this).attr("type") != "" && $(this).attr("type") != undefined && $(this).attr("type") == "number") {
                if ((/^(\+|-)?\d+$/.test(num)) && num > 0) {
                    return true;
                } else {
                    $(this).val(0);
                }
            }
        })
    });

    // // 地址 begin
    // var province_name =$('#province').data('names');
    // var city_name =$('#city').data('names');
    // var area_name =$('#area').data('names');
    // $('#dist').distpicker('destroy');
    // var reset = false
    // $('#province').click(function(){
    //   if(!reset){
    //     $("#dist").distpicker('destroy')
    //     $("#dist").distpicker({ autoSelect:false});
    //     reset=true
    //   }
    // })
    // $('#province').change(function(){
    //   console.log($(this).val())
    //   var val = $(this).val();
    //   $('#province').val(val);
    //   $('#city').val(0)
    //   $('#area').val(0)
    // })
    // $('#city').change(function(){
    //   var val = $(this).val();
    //   $('#city').val(val)
    //   $('#area').val(0)
    // })
    // $('#area').change(function(){
    //   var val = $(this).val();
    //   $('#area').val(val)
    // })


    //   地址end

</script>
</body>
</html>
